<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>显示隐藏文本框</title>
</head>
<body>
    <input type="text" value="请输入内容" style="color: #999;">
    <script>
       let text  = document.querySelector('input');
       text.onfocus = function(){
        if (this.value ==='请输入内容'){
            this.value = '';
        }
        this.style.color ='#333';
       };
       text.onblur = function(){
        if (this.value === ''){
            this.value = '请输入内容';
        }
        this.style.color = '#999';
       };
    </script>
</body>
</html>